home *** CD-ROM | disk | FTP | other *** search
/ Nautilus 1992 July / Nautilus-3-8 / Nautilus-3-8.bin / Tools & Utilities / Hacks Pt.1 ƒ / Chassis 4.2.1 ƒ / KeyDownProc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-14  |  1.4 KB  |  51 lines

  1. /************************************************************************************/
  2. /*    KeyDownProc                                                                        */
  3. /************************************************************************************/
  4.  
  5. #include "MyHeaders.h"
  6.  
  7. int KeyDownProc()
  8. {
  9.     int        KeyDRetCode = 0;
  10.  
  11.     testChar = BitAnd(myEvent.message,charCodeMask);    /* get the character        */
  12.  
  13.     if (BitAnd(myEvent.modifiers,cmdKey) != 0)    /* If command key is down...        */
  14.         {
  15.         worklong = MenuKey(testChar);            /* ...find menu equivalent            */
  16.         if (worklong)                            /* if there is a menu equivalent    */
  17.             WorkRetCode = MenuProc(worklong);    /*   perform menu command            */
  18.         else
  19.             SysBeep(0);                            /* otherwise just beep at em        */
  20.         }
  21.         
  22.     else                                        /* else...                            */
  23.     if (testChar == 0x05)                        /* If "help" key was used            */
  24.         WorkRetCode = HelpGetProc();            /* ...perform Help procedure        */
  25.         
  26.     else
  27.         {
  28.         workWindowPtr = FrontWindow();    /* which is front (active) ?    */
  29.         WorkRetCode = 
  30.                 WhichWindow(workWindowPtr, &k);    /* match ptr to table    */
  31.         if (WorkRetCode == 0)                    /* if it's a good match    */
  32.             {                                    /* then                    */
  33.             windSub = k;                        /*   set the subscrpt    */
  34.             switch (windTbl[windSub].windRec.refCon)    /* window type    */
  35.                 {
  36.                 case (ProcMain):
  37.                     WorkRetCode = MainWindowProc();
  38.                 break;
  39.                 case (ProcText):
  40.                     WorkRetCode = TextWindowProc();
  41.                 break;
  42.                 case (ProcHelp):
  43.                     WorkRetCode = HelpWindowProc();
  44.                 break;
  45.                 }
  46.             }
  47.         }
  48.  
  49.     return KeyDRetCode;
  50. }
  51.